package org.fatmansoft.teach.entity.ViewEntity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.Size;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "student_campus_card_cost")
public class StudentCampusCardCost {
    //    学生校园卡消费表
    //主键id
    //充值或者消费：用1和0替代
    //充值或者消费时间（包括年月日时分秒）
    //充值或消费描述（就放个varchar就可以前端负责传值）
    //绑定学生外键
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;  //ID

    private Integer costType;  //消费类型

    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date costTime;   //消费时间

    @Size(max = 100)
    private String costInfo;  //学生消费描述

    @ManyToOne
    @JoinColumn(name = "s_id")
    private Student student;
}
